#ifndef  _CGUINAVIGATE_H_
#define  _CGUINAVIGATE_H_

class CArkWnd;

enum EDirection { eLeftTop,    eTop,    eRightTop,
                  eLeft,       eCenter, eRight,
                  eLeftBottom, eBottom, eRightBottom,
				  eDirCount };

#define  BLOCK_WIDTH  128

class CGuiNavigate
{
public:
	CGuiNavigate();
	~CGuiNavigate();


	void ReadFile( const char* szTexFile );
	void ResetMap( int x, int y, CArkWnd* pArkWnd, const char* szTexFile );

	void Drawing( CArkWnd* pArkWnd );
	void CalDrawing( CArkWnd* pArkWnd, int xPos, int yPos );
	void InitData( CArkWnd* pArkWnd );

private:
	void CreateBlock( CArkWnd* pArkWnd, EDirection eDir );
	void CalCenterStart(int x, int y);
	void ResetXCenterStart( EDirection eDir );
	void ResetYCenterStart( EDirection eDir );
	void CheckRectValid( RECT& rc );
	void ClearData();
	

public:
	struct TexInfo
	{
		TexInfo():pTex(NULL){};

		EDirection     eDir;
		ITexture*      pTex;
		RECT           rcBlock;
	};

	TexInfo        m_aTexInfo[eDirCount];
	char*          m_pMem;  
	int            m_TexSize[2];
	int            m_xCenterStart;
	int            m_yCenterStart;
	RECT           m_rcWnd;
	TEXTUREFORMAT  m_eTexFormat;

	HANDLE         m_hFile;
	HANDLE         m_hFileMap;
};

#endif